<?php
namespace Admin\Controller;
use Think\Controller;

/**
 * @Author: Martin Zhou
 * @Version: 1.0.1
 * @Copyright Tencent Security Response Center (TSRC)
 * @Project  https://security.tencent.com/index.php/xsrc
*/

class CheckController extends Controller
{

    public function htmlview(){
		$id = I('get.session_id');
		$restriction['visible'] = array('EQ','1');
		$restriction['session'] = array('NEQ','0');
        $model = M('post')->where($restriction)->where(array('session'=>$id))->find();
        $this->assign('model',$model);
        $this->assign('id',$id);
		$this->display();
    }
    
    
    /**
     * 保存修复描述内容
     */
    public function saveRepay(){ 
        
        if (IS_POST) {
            $model = D("Post");
            $model->time = time();
            
            $id = I('post.session_id');
            $repair_method = I('post.repair_method'); 
            $data = I('post.'); 
            $data['type'] = 4;
            if ($model->where(array('session'=>$id))->field('repair_method,type')->save($data)) { 
                $result = ['code'=> 200, 'msg' => '记录成功'];
                $this->ajaxReturn($result,'JSON'); 
            } else {
                $result = ['code'=> 200, 'msg' => '记录未修改'];
                $this->ajaxReturn($result,'JSON'); 
            }
        }
    }
}